home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
nn.zip
/
MK_ONLIN.E_M
< prev
next >
Wrap
Text File
|
1989-12-31
|
2KB
|
144 lines
# convert a manual to a folder
sed -e 's/\\f[BPI]//g' \
-e 's/\\-/-/g' \
-e 's/\\&//' \
-e '/^\.\\" /d' \
-e '/^\.nf/d' \
-e '/^\.fi/d' \
-e '/^\.if/d' \
-e '/^\.ta/d' \
-e '/^\.nr/d' \
-e '/^\.in/d' \
-e 's/^\.[BI] //' "$@" |
awk '
BEGIN {
l=""
o=""
m=72
a=0
h=""
t=0
tab=sprintf("%c",9)
}
/^\.SH / {
if (a) printf("%s\n\n", l)
a++
l=o=""
z=u=0
printf("From: %s\nSubject:", h);
for (i = 2; i <= NF; i++) printf(" %s", $i);
printf("\n\n");
next
}
/^\.TH / {
h=$2
next
}
/^\.UC / {
next
}
/^\.br/ {
if (l != o) printf("%s\n", l)
l=o
z=u
next
}
/^\.PP/ {
if (l != o) printf("%s\n", l)
printf("\n")
l=" "
z=3
o=""
u=0
next
}
/^\.LP/ || /^\.sp/ {
if (l != o) printf("%s\n", l)
printf("\n")
l=""
o=""
z=u=0
next
}
/^\.TP/ {
if (l != o) printf("%s\n", l)
printf("\n")
getline
l=$0
z=u=5
o=" "
if (length(l) >= 5) {
printf("%s\n", l)
l=o
} else while (length(l) < 4) l=l " "
next
}
/^\.\\"ta/ {
for (t=2; t <= NF; t++) to[t-1] = $t
t=NF
next
}
/^\.DT/ {
t=0
next
}
t != 0 {
j=length($0)
k=0; g=1
for (i=1; i<=j; i++) {
while (k < to[g]) {
printf(" ")
k++
}
c=substr($0,i,1)
if (c == tab) {
g++
} else {
printf("%s", c)
k++
}
}
printf("\n")
next
}
{
s=1
p=" "
q=1
}
/^[ ]/ {
if (l != o) printf("%s\n",l)
l=o " "
z=u+5
}
/^\.[IB] / {
s=2
}
/^\.[IB]R / {
s=2
p=""
q=0
}
{
r=" "
while (s <= NF) {
k=length($s)
if ((z+k) > m) {
printf("%s\n", l)
l=o
z=u
}
if (l != o)
l=l r $s
else
l=l $s
z=z + q + k
r=p
s++
}
}
END {
if (l != o) printf("%s\n\n", l)
}'